﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Dept.aspx.cs" Inherits="CentalineWeb.Dept" %>

<asp:Content ID="Content2" ContentPlaceHolderID="cpHead" runat="server">
    <title>组织架构</title>
    <script language="javascript" type="text/javascript">
        $(function () {
            $("a[target='main']").click(function () {
                window.parent.openNewUrl($(this).attr("href"), $(this).html());
                return false;
            });
            $("#txtAddress").combotree({
                data: <%=DeptListJson%>,
                required:true,
                onClick: function(node) {
                    $("#txtAddress").val(node.text);
                }
            });
            $("#txtAddress1").combotree({
                data: <%=DeptListJson%>,
                required:true,
                onClick: function(node) {
                    $("#txtAddress1").val(node.text);
                }
            });
        });
        function addDept() {
            if ($("#txtDeptName").val()== "") {
                alert("部门名称不能为空!");
                return false;
            }
            if ($("#txtAddress").val()== "==请选择所属部门==") {
                alert("请选择所属部门!");
                return false;
            }
        }
        function modifyDept() {
            if ($("#txtDeptName1").val() == "") {
                alert("部门名称不能为空!");
                return false;
            }
            if ($("#txtAddress1").val() == "==请选择所属部门==") {
                alert("请选择所属部门!");
                return false;
            }
        };
    </script>

    <link href="Styles/Stylesheet.css" rel="stylesheet" />

</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cpContent" runat="server">
    <div style="width: 100%;margin: auto">
        <div style="width: 300px; height: 600px; overflow: auto; border: 1px solid gray;display: inline-block;">
            <div id="search">
                <asp:TextBox runat="server" ID="txtCondition"></asp:TextBox>
                <asp:Button runat="server" ID="btnSearch" Text="搜索" OnClick="btnSearch_Click" />
            </div>
            <asp:TreeView ID="trvWorkSpace" runat="server" OnSelectedNodeChanged="trvWorkSpace_SelectedNodeChanged">
                <SelectedNodeStyle BackColor="#999999" />
            </asp:TreeView>
        </div>
        <div style="width: 500px; height: 600px;display: inline-block; margin-left: 50px;border: 1px solid gray; float: right">
            <div id="op">
                <input type="button" id="add" value="增加新部门" onclick="$('#dd').dialog('open');$('#dd').parent().appendTo($('form:first'))" />
                <input type="button" id="modify" value="修改部门" onclick="$('#dd1').dialog('open');$('#dd1').parent().appendTo($('form:first'))" />
                <asp:Button runat="server" ID="btnDel" Text="删除该部门" OnClick="btnDel_Click" OnClientClick="return confirm('确定删除！')" />
                <asp:Button ID="btnSync" runat="server" Text="同步组织架构" OnClick="btnSync_click" OnClientClick="return confirm('确定要同步！')" />
            </div>
            <asp:GridView Width="500" runat="server" ID="gvUsers" AutoGenerateColumns="False" AllowPaging="True" OnPageIndexChanging="gvUsers_PageIndexChanging1" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
                <Columns>
                    <asp:BoundField DataField="empname" HeaderText="姓名" />
                    <asp:BoundField DataField="empno" HeaderText="员工编号" />
                    <asp:BoundField DataField="domainaccount" HeaderText="域账号" />
                    <asp:BoundField DataField="positionname" HeaderText="职位" />
                </Columns>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#F1F1F1" />
                <SortedAscendingHeaderStyle BackColor="#007DBB" />
                <SortedDescendingCellStyle BackColor="#CAC9C9" />
                <SortedDescendingHeaderStyle BackColor="#00547E" />
            </asp:GridView>
        </div>
        <div id="dd" class="easyui-dialog" title="添加部门" style="width: 400px; height: 200px;"
            data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true">
            <table>
                <tr>
                    <td style="text-align: right">名称：</td>
                    <td>
                        <asp:TextBox class="easyui-validatebox" runat="server" ID="txtDeptName" ClientIDMode="Static" />
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right">上级部门：</td>
                    <td>
                        <asp:TextBox ID="txtAddress" Text="==请选择所属部门==" Style="width: 200px;" runat="server" ClientIDMode="Static" />
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right"></td>
                    <td>
                        <asp:Button runat="server" ID="btnSave" Text="确定" ClientIDMode="Static" Width="76px" OnClick="btnSave_Click" OnClientClick="return addDept()" />
                    </td>
                </tr>
            </table>
        </div>
        <div id="dd1" class="easyui-dialog" title="修改部门" style="width: 400px; height: 200px;"
            data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true">
            <table>
                <tr>
                    <td style="text-align: right">名称：</td>
                    <td>
                        <asp:TextBox class="easyui-validatebox" runat="server" ID="txtDeptName1" ClientIDMode="Static" />
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right">上级部门：</td>
                    <td>
                        <asp:TextBox ID="txtAddress1" Text="==请选择所属部门==" Style="width: 200px;" runat="server" ClientIDMode="Static" />
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right"></td>
                    <td>
                        <asp:Button runat="server" ID="btnSave1" Text="确定" ClientIDMode="Static" Width="76px" OnClick="btnSave1_Click" OnClientClick="return modifyDept()" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
</asp:Content>

